</div>
    <!-- /.content-header -->

    <!-- Main content -->
    <div class="content">
      <div class="container-fluid">
        
      </div>
      <!-- /.container-fluid -->
    </div>
    <!-- /.content -->
  </div>
  <!-- /.content-wrapper -->

  <!-- Control Sidebar -->
  <aside class="control-sidebar control-sidebar-dark">
    <!-- Control sidebar content goes here -->
  </aside>
  <!-- /.control-sidebar -->

  <!-- Main Footer -->
  <footer class="main-footer">
    <!-- To the right -->
    <div class="float-right d-none d-sm-block-down">
      Anything you want
    </div>
    <!-- Default to the left -->
    <strong>Copyright &copy; 2018</strong>
  </footer>
</div>
<!-- ./wrapper -->

<!-- REQUIRED SCRIPTS -->

<!-- jQuery -->
<script src="/manual/plugins/jquery/jquery.min.js"></script>
<!-- Bootstrap -->
<script src="/manual/plugins/bootstrap/js/bootstrap.bundle.min.js"></script>
<!-- AdminLTE -->
<script src="/assets/js/layer/layer.js"></script>
<script src="/manual/js/adminlte.js"></script>

<script>
    $(function(){

        $('.apiLink').click(function () {
            var api = $(this).closest('.api');
            var title = api.find('.title').text();
            var uri = api.find('.uri').text();
            let url = $('.environment').val() + uri;
            layer.open({title:title,type:2,content:url,area:['50%','50%']});
        });

        $('.testbtn').click(function(){
            var api = $(this).closest('.api');
            var title = api.find('.title').text();
            var uri = api.find('.uri').text();
            var url = $('.environment').val() + uri;
            var apiparams = {};

            api.find('.param').each(function(){
                var name = $(this).data('name').replace(/^\s+/, "").replace(/\s+$/, "")
                if(name) {
                    apiparams[name] = $(this).val();
                }

            });

            layer.load(0, {shade: false,});
            $.ajax({
                url: url,
                // beforeSend: function(xhr) {
                //     xhr.setRequestHeader("user-token", '88888888888888888888888888888888');
                // },
                data: apiparams,
                headers: {'user-token': $('.token').val()},
                type: 'POST',
                crossDomain: true,
                success: function(res) {
                    // if(res.code == 102) {
                    //     Err(res.msg)
                    //     window.location.href = 'http://www.c.com/html/login/index.html'
                    // }
                    layer.open({type:1,title:title+'|'+uri,shade:false,maxmin: true,content:'<pre>'+JSON.stringify(res, null, 2)+'</pre>'});
                    layer.closeAll('loading');
                }
            });
            // $.post(url,apiparams,function(res){
            //     layer.closeAll('loading');
            //     layer.open({type:1,title:title+'|'+uri,shade:false,maxmin: true,content:'<pre>'+JSON.stringify(res, null, 2)+'</pre>'});
            // },'json');

            console.log(apiparams);

        });
        
        $('.getTable').click(function () {
            let table = $(this).data('table');
            layer.load(0, {shade: false,});
            $.get('{:url("getTable")}',{table:table},function (res) {
                layer.closeAll('loading');
                // layer.open('<pre>'+JSON.stringify(res, null, 2)+'</pre>',{title:table,shade:false,maxmin: true});
                layer.open({type:1,title:table,shade:false,maxmin: true,
                    content:'<pre>'+JSON.stringify(res, null, 2)+'</pre>'
                });
            });
        });
        $('.refreshData').click(function () {
            layer.load(0, {shade: false,});
            $.get('{:url("refreshData")}',{},function (res) {
                layer.closeAll('loading');
                window.location.reload();
            });
        });
    });

    function syntaxHighlight(json) {
        if (typeof json != 'string') {
            json = JSON.stringify(json, undefined, 2);
        }
        json = json.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>');
        return json.replace(/("(\\u[a-zA-Z0-9]{4}|\\[^u]|[^\\"])*"(\s*:)?|\b(true|false|null)\b|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?)/g, function(match) {
            var cls = 'number';
            if (/^"/.test(match)) {
                if (/:$/.test(match)) {
                    cls = 'key';
                } else {
                    cls = 'string';
                }
            } else if (/true|false/.test(match)) {
                cls = 'boolean';
            } else if (/null/.test(match)) {
                cls = 'null';
            }
            return '<span class="' + cls + '">' + match + '</span>';
        });
    }

    $(".showdata").click(function(){
        // $(this).siblings('p').show();
        var html = $(this).siblings('p').html();
        html = '<pre>' + html + '</pre>';
        $('.tanchuang .content').html(html);
        $('.tanchuang').show();
    });
    $(".hidedata").click(function(){
        $('.tanchuang').hide();
    });
</script>

<!-- OPTIONAL SCRIPTS -->
</body>
</html>